<?php
/**
 * Created by PhpStorm.
 * User: tri
 * Date: 8/14/2014
 * Time: 11:40 AM
 */
$countVote = $this->countVote;
$countVote = $countVote[0]['count_vote'];

?>
<div class="grid_profile">
		    		<!-- container_profile -->
				   		<div class="container_profile">
				   			<?php if( file_exists( 'public/avatar/large_'.$this->info->avatar ) ) : ?>
    <a data-url="" href="<?php echo URL_BASE.'public/avatar/large_'.$this->info->avatar; ?>" class="galeryAvatar">
        <?php
        $avatar = $this->info->avatar;
        if(strstr($avatar,'facebook') == false){
            $avatar =   URL_BASE.'public/avatar/'.$this->info->avatar;
            $status = get_headers($avatar);
            if($status[0] == 'HTTP/1.1 404 Not Found'){
                $avatar =  URL_BASE."thumb/48-48-public/avatar/avatar.png";
            }
            if($voter['user_avatar'] == ''){
                $avatar =  URL_BASE."thumb/48-48-public/avatar/avatar.png";
            }
        }
        ?>
        <img src="<?php echo $avatar ?>"  class="avatar_large" />
    </a>
<?php
else:
    ?>
    <?php
    $avatar = $this->info->avatar;
    if(strstr($avatar,'facebook') == false){
        $avatar =   URL_BASE.'public/avatar/'.$this->info->avatar;
        $status = get_headers($avatar);
        if($status[0] == 'HTTP/1.1 404 Not Found'){
            $avatar =  URL_BASE."thumb/48-48-public/avatar/avatar.png";
        }
        if($voter['user_avatar'] == ''){
            $avatar =  URL_BASE."thumb/48-48-public/avatar/avatar.png";
        }
    }
    ?>
    <img src="<?php echo $avatar ?>"  class="avatar_large" />
<?php
endif;//<<--- File Exists ?>

<!-- profile detail -->
<div class="profile_detail">
					   				<span class="detail_top" >
					   					<h1><?php echo stripslashes( $this->info->name ); ?></h1>

                                        <?php if( $this->info->type_account == '1' ): ?>
                                            <img title="<?php echo $_SESSION['LANG']['verified']; ?>" class="verified_img west" src="<?php echo URL_BASE; ?>public/img/verified.png">
                                        <?php endif; ?>

                                        <strong>@<?php echo $this->info->username; ?></strong>
                                        <?php if( $this->followActive->status == 1 ): ?>
                                            <span class="isFollow"><?php echo $_SESSION['LANG']['follows_you']; ?></span>
                                        <?php endif;?>
                                        <a class="right-align update-profile-text" href="<?php echo URL_BASE.$this->infoSession->username;  ?>/updateUserProfile">Profile Update</a>
					   				</span><!-- detail_top -->

    <ul class="user_data">
        <li>
					   						<span class="container_data_profile grid_first">
					   							<a href="<?php echo URL_BASE.$this->info->username; ?>">
                                                    <span class="countData"><?php echo _Function::formatNumber( $countPost ); ?></span>
                                                    <span class="title_data"><?php echo $_SESSION['LANG']['posts']; ?></span>
                                                </a>
					   						</span>
        </li>

        <li>
					   						<span class="container_data_profile">
					   							<a href="<?php echo URL_BASE.$this->info->username.'/followers'; ?>">
                                                    <span class="countData"><?php echo _Function::formatNumber( $this->info->totalFollowers ); ?></span>
                                                    <span class="title_data"><?php echo $_SESSION['LANG']['followers']; ?></span>
                                                </a>
					   						</span>
        </li>

        <li>
					   						<span class="container_data_profile">
					   							<a href="<?php echo URL_BASE.$this->info->username.'/following'; ?>">
                                                    <span class="countData"><?php echo _Function::formatNumber( $this->info->totalFollowing ); ?></span>
                                                    <span class="title_data"><?php echo $_SESSION['LANG']['following']; ?></span>
                                                </a>

					   						</span>
        </li>

        <?php

        if($_SESSION['authenticated'] != $this->info->id){  ?>
            <span style="float: right;margin-top: 10px">
            <a data-follow="Follow" data-following="Following" class="link_small whofollow" data-username="<?= $this->info->username ?>" data-id="<?= _Function::randomString( 10, FALSE, TRUE, FALSE ).'-'.$this->info->id?>">	Follow @<?=$this->info->username ?></a>
        </span>
       <?php  }
        ?>


<!--        <li class="">-->
<!--					   						<span class="container_data_profile">-->
<!--					   							<a href="--><?php //echo URL_BASE.$this->info->username.'/favorites'; ?><!--">-->
<!--                                                    <span class="countData">--><?php //echo _Function::formatNumber( $countFavs ); ?><!--</span>-->
<!--                                                    <span class="title_data">--><?php //echo $_SESSION['LANG']['favorites']; ?><!--</span>-->
<!--                                                </a>-->
<!--					   						</span>-->
<!--        </li>-->
        <li class="last_li">
					   						<span class="container_data_profile">
					   							<a href="<?php echo URL_BASE.$this->info->username.'/userVote'; ?>">
                                                    <span class="countData"><?php echo _Function::formatNumber( $countVote ); ?></span>
                                                    <span class="title_data"><?php echo 'Votes'; ?></span>
                                                </a>
					   						</span>
        </li>
    </ul><!-- user_data -->


</div><!-- profile_detail -->
<?php if( $this->info->bio != '' ) :

    $styleP = ' style="margin: 0; border: none; padding: 0;"';

    ?>
    <p class="about_user">

        <?php

        if( $this->getCountryUser->country != FALSE ) {
            echo '<strong>'.$this->getCountryUser->country.'</strong><br />';
        }

        echo _Function::CheckText( $this->info->bio ); ?>
    </p>
<?php
else:

    $styleP = null;

endif; ?>

<?php if( $this->info->location != '' || $this->info->website != '' ) : ?>
    <?php

    if( $this->info->location != '' && $this->info->website != '' ) :
        $separator = ' - ';
    endif;
    ?>
    <p class="about_user"<?php echo $styleP; ?>>
        <?php echo stripslashes( htmlspecialchars( $this->info->location ) ) . $separator; ?> <?php echo _Function::linkText( $this->info->website ); ?>
    </p>
<?php endif; ?>

</div><!-- container_profile -->
</div><!-- nav_profile -->